package com.foreknow.elmboot.mapper;

import com.foreknow.elmboot.po.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    /**
     * 登录
     * @param userId
     * @param password
     * @return User对象
     * @throws Exception
     */
    @Select("select * from user where userId=#{userId} and password=#{password}")
    public User getUserByIdByPass(String userId, String password) throws Exception;

    /**
     * 注册
     * @param userId
     * @param password
     * @param userName
     * @param userSex
     * @return
     * @throws Exception
     */
    @Insert("insert into user(userId,password,userName,userSex,delTag) values(#{userId},#{password},#{userName},#{userSex},1)")
    public int saveUser(String userId,String password,String userName,String userSex)throws Exception;
}
